/*
 * @Description: 文章帖子
 * @Author: chenjiaxin
 * @Date: 2021-12-26 10:42:01
 * @LastEditTime: 2022-01-04 23:01:44
 * @FilePath: \novel-serve\src\router\article.router.js
 */

const Router = require("koa-router");

const { verifyAuth } = require("../middleware/auth.middleware");
const { create, getArticle } = require("../controller/article.controller");
const { paramCheckBody, paramCheckQuery } = require("../middleware/check.middleware");

const articleRouter = new Router({prefix: "/article"});

// 保存文章接口
articleRouter.post("/save", paramCheckBody(true, "title", "content"), verifyAuth, create);

// 获取文章接口
articleRouter.get("/getDetail", paramCheckQuery(true, "id"), verifyAuth, getArticle);

module.exports = articleRouter;

